fix: ensure consistency between controlled and uncontrolled logic#685
Open
Yuiai01 wants to merge 1 commit intoreact-component:masterfrom
Open
fix: ensure consistency between controlled and uncontrolled logic#685Yuiai01 wants to merge 1 commit intoreact-component:masterfrom
Yuiai01 wants to merge 1 commit intoreact-component:masterfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Codecov Report
@@ Coverage Diff @@
## master #685 +/- ##
=======================================
Coverage 98.94% 98.94%
=======================================
Files 56 56
Lines 2457 2466 +9
Branches 734 737 +3
=======================================
+ Hits 2431 2440 +9
Misses 24 24
Partials 2 2
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
close ant-design/ant-design#44992 (comment)
问题背景:
在该 PR 之前如果 RangePicker 的 open 设置为 true,因为没有初始化 nextActiveIndex,所以根据 afferentOpen 和 index 等判断 nextActiveIndex,但是这样会导致 nextActiveIndex 永远不会是 null,因此永远不会触发关闭时间选择面板的逻辑(不会触发 onOpenChange)。
该 PR 的作用是当 RangePicker 处于选择完日期也就是可关闭状态时触发关闭选择时间面板的逻辑(会触发 onOpenChange),当 open 受控变成 false 时,需要将 focus 动画取消,并且由于 mergedActivePickerIndex 会先改变因此需要改回去。